<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <script src="jQuery复习/jquery-3.3.1.js"></script>
  <style>
     table{
	    width:500px;
		height:200px;
		border-collapse:collapse;
		border-spacing:0;
	 }
     table tr td{
	    border:solid 1px black;
	 }
  </style>
 </head>
 <body>
    <table>
	   <tr> <td></td> <td></td> <td></td> </tr>
	   <tr> <td></td> <td></td> <td></td> </tr>
	   <tr id="tr1"> <td></td> <td></td> <td></td> </tr>
	   <tr> <td></td> <td></td> <td></td> </tr>
	   <tr> <td></td> <td></td> <td></td> </tr>
	</table>
 </body>
 <script>
    //选择第一个tr元素
	$("table tr:first").css({"backgroundColor":"blue"});
	//选择最后一个tr元素
	$("table tr:last").css({"backgroundColor":"blue"});
	//选择所有偶数tr元素
	$("table tr:even").css({"backgroundColor":"yellow"});
	//选择所有奇数tr元素
	$("table tr:odd").css({"backgroundColor":"red"});
	//选择第三个tr元素
	$("table tr:eq(3)").css({"backgroundColor":"white"});
    //选择所有index大于3的tr元素
	$("table tr:gt(3)").css({"backgroundColor":"white"});
	//选择所有index小于3的tr元素
	$("table tr:lt(3)").css({"backgroundColor":"white"});
	//选择所有id不为tr1的tr元素
    $("table tr:not(#tr1)").css({"backgroundColor":"yellow"});
 </script>
</html>
